package com.acwing.partition35;

import java.io.*;

/**
 * @author rkc
 * @date 2022/7/23 10:32
 */
public class AC3432二叉树 {

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        int x = nextInt(), y = nextInt();
        while (x != y) {
            if (x > y) x >>= 1;
            else y >>= 1;
        }
        writer.println(x);
        writer.flush();
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
